home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BCI NET
/
BCI NET Dec 94.iso
/
archives
/
telecomm
/
bbs
/
axshsupp.lha
/
AXsh-SZIMEX03.lha
/
SubZeroExport.rexx
next >
Wrap
OS/2 REXX Batch file
|
1993-01-02
|
3KB
|
123 lines
/****** SubZeroExport.rexx ***************************************************
*
* $VER: SubZeroExport 0.3á (02-Jan-93) - A Mail/News scanner for SubZeroNet
*
******************************************************************************
*
* Naming conventions:
* ~~~~~~~~~~~~~~~~~~~
* Mail {machine}.mail.{ufn} Mail batch
* News {machine}.news.{ufn} News batch
*
* Xfer {machine}.uucp.{ufn} TrapDoor transfer archive
*
******************************************************************************/
SIGNAL ON HALT
SIGNAL ON ERROR
SIGNAL ON BREAK_C
OPTIONS FAILAT 21
suppLib = 'rexxsupport.library'
OUTBOUND = 'OUT:'
UUSPOOL = 'AXSH:usr/spool/'
UUMAIL = UUSPOOL || 'mail/'
UUNEWS = UUSPOOL || 'news/'
MAIL_EXT = '.mail.'
NEWS_EXT = '.news.'
UUCP_EXT = '.uucp.'
NETWORK = 'subzero.dk'
/****** These are the machines we're connected to ****************************/
Mach.1.uucp = 'thesystem'
Mach.1.fido = '2.230.149.0.DLO'
Mach.2.uucp = 'ussce.van'
Mach.2.fido = '2.230.317.0.CLO'
MaxMachines = 2
/*****************************************************************************/
IF ~SHOW('L',suppLib) THEN CALL ADDLIB(suppLib,0,-30,0)
DO i = 1 TO MaxMachines
Mach.i.name = Mach.i.uucp || '.' || NETWORK
Mach.i.mail = UUMAIL || Mach.i.name
Mach.i.news = UUNEWS || Mach.i.name
Mach.i.flow = OUTBOUND || Mach.i.fido
Mach.i.xfer = OUTBOUND || Mach.i.uucp || UUCP_EXT || UFN()
/*
** First we handle mail...
*/
Has_added_file = 0
IF EXISTS(Mach.i.mail) THEN DO
newName = UUMAIL || Mach.i.uucp || MAIL_EXT || UFN()
IF ADD2FLOW(Mach.i.flow Mach.i.xfer) ~= 0 THEN DO
Has_added_file = 1
CALL DELAY(50) /* Just in case... */
CALL RENAME(Mach.i.mail,newName)
ADDRESS COMMAND 'LhA m' Mach.i.xfer newName /* Move it into archive */
END
END
/*
** ... then news:
*/
ADDRESS COMMAND 'AXSH:bin/RN net' Mach.i.name 'pack' /* Do a final scan */
IF EXISTS(Mach.i.news) THEN DO
newName = UUNEWS || Mach.i.uucp || NEWS_EXT || UFN()
IF ADD2FLOW(Mach.i.flow Mach.i.xfer) ~= 0 THEN DO
CALL RENAME(Mach.i.news,newName)
ADDRESS COMMAND 'LhA m' Mach.i.xfer newName /* Move it into archive */
END
END
END
EXIT /* All done :-) */
/*
** This routine adds a file to a flow file
*/
ADD2FLOW:
PARSE ARG kurt
IF Has_added_file == 0 THEN DO
flo = WORD(kurt,1)
fil = WORD(kurt,2)
IF OPEN('fh',flo,'A') == 0 THEN DO
IF OPEN('fh',flo,'W') == 0 THEN RETURN 0
END
CALL SEEK('fh',0,'E') /* Seek to end of file */
CALL WRITELN('fh','-' || fil) /* Tell TD to kill'em! */
CALL CLOSE('fh')
END
RETURN 1
/*
** Unique file name based on UN*X datestamp
*/
UFN:
RETURN D2X(DATE('I')*86400+TIME('S')+252460800,8)
HALT:
BREAK_C:
SAY '***Break: User abort requested!'
EXIT 1
ERROR:
SAY '***Break: Error in line' SIGL
EXIT 10
/*
** EOF
*/